AlgoWiki

Floor sum

Sums of the form

i=1npi+qr\sum_{i=1}^n \left\lfloor \frac{pi+q}{r} \right\rfloor

can be evaluated in O(logn)O(\log n) time. See Summation of Floor Function Series for a special case.

Problems